package com.xqboss.apps.convert.user;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.ReadCellData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.xqboss.apps.enums.user.UserNftSourceTypeEnum;
import com.alibaba.excel.enums.CellDataTypeEnum;

/**
 * @author Administrator
 */
public class ExportUserNftSourceTypeEnumConverter implements Converter<UserNftSourceTypeEnum> {
    @Override
    public Class supportJavaTypeKey() {
        return UserNftSourceTypeEnum.class;
    }

    @Override
    public WriteCellData<?> convertToExcelData(UserNftSourceTypeEnum value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return new WriteCellData<>(value.getMsg());
    }

    @Override
    public UserNftSourceTypeEnum convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
        return UserNftSourceTypeEnum.valueOf(cellData.getStringValue());
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }
}
